package com.huawei.appgallery.purchasehistory.ui.activity;

import android.app.ActionBar;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.service.common.protocol.request.AppListFragmentRequest;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.uikit.ContractFragment;
import com.huawei.appgallery.purchasehistory.api.AppTracesListFragmentProtocol.Request;
import com.huawei.appgallery.purchasehistory.ui.protocol.FamilyShareEditListFragmentProtocol;
import com.huawei.appgallery.purchasehistory.ui.protocol.PurchaseHistoryFamilyShareProtocol;
import o.azb;
import o.azc;
import o.cgv;
import o.cjk;
import o.cjm;
import o.cjo;
import o.csp;
import o.cst.a;
import o.cst.d;
import o.cst.e;
import o.cst.h;
import o.evx;

public class PurchaseHistoryFamilyShareActivity extends BaseActivity<PurchaseHistoryFamilyShareProtocol> {
    private String ͺ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(d.ॱ);
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(a.ʼ));
        cgv.ˋ(this, a.ॱ, a.ˊ);
        ͺ();
        this.ͺ = UserSession.getInstance().getUserId();
        ᐝ();
    }

    private void ᐝ() {
        PurchaseHistoryFamilyShareProtocol purchaseHistoryFamilyShareProtocol = (PurchaseHistoryFamilyShareProtocol) ʾ();
        if (purchaseHistoryFamilyShareProtocol != null) {
            cjo familyShareEditListFragmentProtocol = new FamilyShareEditListFragmentProtocol();
            AppListFragmentRequest request = new Request();
            request.ˋॱ(this.ͺ);
            request.ॱ(1);
            familyShareEditListFragmentProtocol.ˏ(request);
            ContractFragment contractFragment = (ContractFragment) cjk.ˎ().ˊ(new cjm(purchaseHistoryFamilyShareProtocol.ˋ(), familyShareEditListFragmentProtocol));
            if (contractFragment instanceof TaskFragment) {
                ((TaskFragment) contractFragment).ˋ(ˏॱ(), e.ॱॱ, "FamilyShareEditListFragment");
            } else {
                csp.ˏ.ˊ("PurchaseHistoryFamilyShareActivity", "FamilyShareEditListFragment is not instanceof TaskFragment");
            }
        }
    }

    private void ͺ() {
        ॱˊ();
    }

    private void ॱˊ() {
        View findViewById = findViewById(e.ॱͺ);
        azb.ˏ(findViewById);
        ॱ(findViewById);
        ActionBar actionBar = getActionBar();
        if (azc.ˎ().ॱ() < 21) {
            ((TextView) findViewById.findViewById(e.ᐝˋ)).setText(h.ʼ);
            if (actionBar != null) {
                actionBar.hide();
            }
        } else if (actionBar != null) {
            actionBar.show();
            actionBar.setTitle(getString(h.ʼ));
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayOptions(12);
            findViewById.setVisibility(8);
        }
    }

    private void ॱ(View view) {
        view.findViewById(e.ᐧ).setOnClickListener(new evx(this) {
            final /* synthetic */ PurchaseHistoryFamilyShareActivity ˋ;

            {
                this.ˋ = r1;
            }

            public void ˋ(View view) {
                this.ˋ.onBackPressed();
            }
        });
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != 16908332) {
            return super.onOptionsItemSelected(menuItem);
        }
        finish();
        return true;
    }
}
